import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import iView from 'iview'
import store from './store'
import 'iview/dist/styles/iview.css'
import '@/common/stylus/index.styl'
import '@/common/font/iconfont.css'
import axios from 'axios'
Vue.prototype.$http = axios
Vue.use(iView)
process.env.NODE_ENV == 'production' ? axios.defaults.baseURL = process.env.API_ROOT : ''
axios.interceptors.request.use(function (config) {
  // Do something before request is sent
  iView.LoadingBar.start();
  return config;
}, function (error) {
  // Do something with request error
  return Promise.reject(error);
})
axios.interceptors.response.use(function (response) {
  // Do something with response data
  iView.LoadingBar.finish();
  return response;
}, function (error) {
  // Do something with response error
  return Promise.reject(error);
})
Vue.config.productionTip = false
// axios.defaults.headers.post['Content-Type'] = "application/x-www-form-urlencoded"
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
